#!/usr/bin/python

import sys
from shutil import copyfile
import version as sw

src = "*.hex"
if len(sys.argv) < 2:
    print("No File Name!")
    sys.exit(1)
else:
    src = sys.argv[1]

names = src.split('.')
if len(names) != 2:
    print("File Name Error!")
    sys.exit(2)

src_name = names[0]
src_type = names[1]
dst = "{}_{}.{}".format(src_name, sw.version, src_type)

print("Generating: " + dst)
copyfile(src, dst)
